import copy
import json
import os
import pickle

from PyQt5 import QtCore
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QStandardItem
from PyQt5.QtWidgets import QFileDialog, QTreeWidgetItemIterator, QTreeWidgetItem, QMessageBox

from huza.base.mainwindow_run import MainWindowRun
from huza.base.widget import PopQDialog
from huza.puis.showicon import ShowIcon_Form
from loguru import logger

from uis.webview import WebView_Form



def connect_exit(self):
    exit = self.get_action('exit')
    exit.triggered.connect(self.mainwindow.close)


def connect_showicon(self):
    showicon = self.get_action('showicon')

    def showicon_tri():
        self.set_dock_view('icon', '图标', 'main', ShowIcon_Form)

    showicon.triggered.connect(showicon_tri)


def connect_test(self):
    test = self.get_action('test')

    def test_tri():
        self.set_dock_view('webui', '图标', 'main', WebView_Form)

    test.triggered.connect(test_tri)




def init_connect(self: MainWindowRun):
    connect_exit(self)
    connect_showicon(self)
    connect_test(self)
